<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header2"></head>
<th:block th:include="include :: summernote-css" />

<style type="text/css">
	body{overflow:auto;}
  thead tr {background-color: ActiveCaption; color: CaptionText;}
  th, td {vertical-align: top; font-family: "宋体", Arial, Helvetica, sans-serif; font-size: 9pt; padding: 3px; }
  table, td {border: 1px solid silver;}
  table {border-collapse: collapse;}
  thead .col0 {width: 20%;}
  thead .col1 {width: 75%;}
	td.col0{font-size:18px;font-weight:bold;color:#f00;}
</style>
    
<body class="white-bg">
    <table>
      <thead>
        <tr>
          <th class="col0">章节</th>
          <th class="col1">内容</th>
        </tr>
      </thead>
      <tbody>
		
        <tr>
          <td class="col0">2.4 考核任务</td>
          <td class="col1"><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 26pt; font-family: 宋体; font-size: 18px;">考核任务包括系统的需求分析、系统的功能模块、数据库设计：</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">1</span>）系统的需求分析。（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">30&nbsp;</span>分）</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">2</span>）系统的功能模块。（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">30&nbsp;</span>分）</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">3</span>）数据库设计。（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">40&nbsp;</span>分）</p> </td>
        </tr>
        <tr>
          <td class="col0">本章小结</td>
          <td class="col1"><span style="font-family: 宋体; font-size: 18px; text-align: justify; text-indent: 28px;">本章在项目实战开始前，对系统的需求分析、系统设计、系统功能进行了介绍，使读者对开发系统有一个全面的了解；另外对新闻发布系统需要的数据库表进行了设计和 创建。</span><br /> </td>
        </tr>

		</tbody>
    </table>
        <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title" style="text-align: center;">
                        <!-- <h3>提交作业</h3> -->
                        <!-- <button id="edit" class="btn btn-primary btn-xs m-l-sm" onclick="edit()" type="button">编辑</button> -->
                        <button id="save" class="btn btn-primary  btn-lg" onclick="save()" type="button">提交</button>
                    </div>
                    <div class="ibox-content no-padding" id="eg">

                        <div class="click2edit">
                            
                            
                        </div>

                    </div>
                </div>
            </div>
        </div>
    
    </div>
<div th:include="include :: footer"></div>
    <th:block th:include="include :: summernote-js" />
    <script>
        $(document).ready(function () {
            $('.click2edit').summernote({                
                focus: true,
                height : '220px',
                lang : 'zh-CN',
                placeholder:"在此编辑你的作业，可以图文混排",
                callbacks: {
                    onImageUpload: function(files) {
                    	uploadpic(files[0]);
                        
                    }
                }
            });
        });
        function uploadpic(file){
        	var formData = new FormData();
            formData.append("file", file);
            formData.append("filetype", "img");
            $.ajax({
                type: "POST",
                url: ctx + "common/upload",
                data: formData,
                cache: false,
                contentType: false,
                processData: false,
                dataType: 'json',
                success: function(result) {
                    if (result.code == web_status.SUCCESS) {
                    	var imgNode = document.createElement("img");
			            imgNode.src = ctx+"common/vimg?n="+result.url;
			            $('.click2edit').summernote('insertNode', imgNode);
                        $(".note-image-input").removeAttr("name");
                    } else {
                        $.modal.alertError(result.msg);
                        $(".note-image-input").removeAttr("name");
                    }
                },
                error: function(error) {
                    $.modal.alertWarning("图片上传失败。");
                }
            });
        }
        var save = function () {
            //
            var aHTML = $('.click2edit').summernote('code');
            if(aHTML.trim().length<30)return;
            //$.operate.post(ctx + 'job/sned/edit2',{"snid":"20030622394270842","content":Base64.encode(aHTML)});
            var config = {
        	        url: ctx + 'job/sned/edit2',
        	        type: "post",
        	        dataType: "json",
        	        data: {"snid":"20030622394270842","content":Base64.encode(aHTML)},
        	        beforeSend: function () {
        	        	$.modal.loading("正在处理中，请稍后...");
        	        },
        	        success: function(result) {
        	        	if (result.code == web_status.SUCCESS){
        	        		$.modal.msgSuccess(result.msg);
        	        		$('.click2edit').summernote('reset');
        	        		$.modal.closeLoading();
        	        		var url = ctx + 'job/sned/myjobs';
        	    			$.modal.parentTab("我的作业", url);
        	        	}else{
        	        		$.modal.alertError(result.msg);
        	        		$.modal.closeLoading();
        	        	}        	        	
        	        },
                    error: function(error) {
                        $.modal.alertWarning("提交作业失败。");
                    }
        	    };
        	    $.ajax(config);
            //$("#eg").removeClass("no-padding");
            //$('.click2edit').summernote('destroy');
            
        };
    </script>
</body>
</html>

